package com.devmindset.legoframework.client.mvc;

/**
 * Structure to hold the {@link LegoModel} that goes hand-in-hand 
 * with the fired event.
 *
 * @author <a href="mailto:ice.penov@devmindset.com">Ice Penov</a>
 */
public final class LegoEvent {
  
  private Enum<?> type;
  private LegoModel model;
  
  /**
   * Constructor.
   * 
   *  @param type the event type
   */
  public LegoEvent(Enum<?> type) {
    this.type = type;
  }
  
  /**
   * Constructor.
   * 
   *  @param type the event type
   *  @param model the event model
   */
  public LegoEvent(Enum<?> type, LegoModel model) {
    this(type);
    this.model = model;
  }
  
  /**
   * Returns the type.
   *
   * @return the type
   */
  public Enum<?> getType() {
    return type;
  }

  /**
   * Returns the model.
   *
   * @return the model
   */
  public LegoModel getModel() {
    return model;
  }
  
  public boolean matches(Enum<?> eventType) {
  	return eventType.equals(type);
  }
  
}